<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:p="http://primefaces.org/ui"
                 xmlns:x="http://xpert.com/faces"
                 xmlns:xc="http://java.sun.com/jsf/composite/xpert/components"
                 template="/template/mainTemplate.xhtml">

    <ui:param name="title" value="Entity Converter" />
    <ui:define name="body">

        <div class="description">
           #{msg['entityConverter.description']}<br/><br/>
           #{msg['entityConverter.description2']}
           <b>@Id</b>(javax.persistence.Id) or <b>@ConverterId</b> (com.xpert.faces.conversion.ConverterId)
        </div>

        <p:panel header="#{msg['entityConverter.default']}">
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{msg['person.group']}:" />
                    <h:selectOneMenu value="#{requestScope.group}" converter="entityConverter" >
                        <f:selectItem itemLabel="" />
                        <f:selectItems value="#{findAllBean.get(classMB.group)}" var="group" itemLabel="#{group.description}" />
                    </h:selectOneMenu>
                </h:panelGrid>
                <p:commandButton value="Submit" process="@form" update=":panelDetail" oncomplete="dialogEntityConverter.show()" />
            </h:form>
        </p:panel>
        <br/>
        <p:panel header="#{msg['entityConverter.withInitializer']}">
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{msg['person.group']}:" />
                    <h:selectOneMenu value="#{requestScope.group}" converter="entityConverter" >
                        <f:selectItem itemLabel="" />
                        <f:selectItems value="#{findAllBean.get(classMB.group)}" var="group" itemLabel="#{group.description}" />
                        <p:ajax update="@form" process="@this" />
                    </h:selectOneMenu>

                    <h:outputLabel value="#{msg['group.statusGroup']}:" />
                    <h:outputText style="font-weight: bold;" value="#{requestScope.group.statusGroup.description}">
                        <x:initializer/>
                    </h:outputText>
                </h:panelGrid>
            </h:form>
        </p:panel>

        <p:dialog widgetVar="dialogEntityConverter" header="Detail" width="500" appendToBody="true" modal="true">
            <h:panelGroup id="panelDetail">
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{msg['person.group']}:" />
                    <h:outputText value="#{requestScope.group.description}"/>
                    <h:outputLabel value="ID:" />
                    <h:outputText value="#{requestScope.group.id}"/>
                </h:panelGrid>
                <div align="center" >
                    <p:commandButton type="button" value="Ok" onclick="dialogEntityConverter.hide()"/>
                </div>
            </h:panelGroup>
        </p:dialog>

        <pre name="code" class="xml">
           &lt;p:panel header=&quot;Default&quot;&gt;
                &lt;h:form&gt;
                    &lt;h:panelGrid columns=&quot;2&quot;&gt;
                        &lt;h:outputLabel value=&quot;\#{msg['person.group']}:&quot; /&gt;
                        &lt;h:selectOneMenu value=&quot;\#{requestScope.group}&quot; converter=&quot;entityConverter&quot; &gt;
                            &lt;f:selectItem itemLabel=&quot;&quot; /&gt;
                            &lt;f:selectItems value=&quot;\#{findAllBean.get(classMB.group)}&quot; var=&quot;group&quot; itemLabel=&quot;\#{group.description}&quot; /&gt;
                        &lt;/h:selectOneMenu&gt;
                    &lt;/h:panelGrid&gt;
                    &lt;p:commandButton value=&quot;Submit&quot; process=&quot;@form&quot; update=&quot;:panelDetail&quot; oncomplete=&quot;dialogEntityConverter.show()&quot; /&gt;
                &lt;/h:form&gt;
            &lt;/p:panel&gt;
            &lt;br/&gt;
            &lt;p:panel header=&quot;Combination with Initializer&quot;&gt;
                &lt;h:form&gt;
                    &lt;h:panelGrid columns=&quot;2&quot;&gt;
                        &lt;h:outputLabel value=&quot;\#{msg['person.group']}:&quot; /&gt;
                        &lt;h:selectOneMenu value=&quot;\#{requestScope.group}&quot; converter=&quot;entityConverter&quot; &gt;
                            &lt;f:selectItem itemLabel=&quot;&quot; /&gt;
                            &lt;f:selectItems value=&quot;\#{findAllBean.get(classMB.group)}&quot; var=&quot;group&quot; itemLabel=&quot;\#{group.description}&quot; /&gt;
                            &lt;p:ajax update=&quot;@form&quot; process=&quot;@this&quot; /&gt;
                        &lt;/h:selectOneMenu&gt;

                        &lt;h:outputLabel value=&quot;\#{msg['group.statusGroup']}:&quot; /&gt;
                        &lt;h:outputText style=&quot;font-weight: bold;&quot; value=&quot;\#{requestScope.group.statusGroup.description}&quot;&gt;
                            &lt;x:initializer/&gt;
                        &lt;/h:outputText&gt;
                    &lt;/h:panelGrid&gt;
                &lt;/h:form&gt;
            &lt;/p:panel&gt;

            &lt;p:dialog widgetVar=&quot;dialogEntityConverter&quot; width=&quot;500&quot; appendToBody=&quot;true&quot; modal=&quot;true&quot;&gt;
                &lt;h:panelGroup id=&quot;panelDetail&quot;&gt;
                    &lt;h:panelGrid columns=&quot;2&quot;&gt;
                        &lt;h:outputLabel value=&quot;\#{msg['Person.grupo']}:&quot; /&gt;
                        &lt;h:outputText value=&quot;\#{requestScope.group.description}&quot;/&gt;
                        &lt;h:outputLabel value=&quot;ID:&quot; /&gt;
                        &lt;h:outputText value=&quot;\#{requestScope.group.id}&quot;/&gt;
                    &lt;/h:panelGrid&gt;
                    &lt;div align=&quot;center&quot; &gt;
                        &lt;p:commandButton type=&quot;button&quot; value=&quot;Ok&quot; onclick=&quot;dialogEntityConverter.hide()&quot;/&gt;
                    &lt;/div&gt;
                &lt;/h:panelGroup&gt;
            &lt;/p:dialog&gt;
        </pre>


    </ui:define>
</ui:composition>
